#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
using pii = pair<int, int>;
const int N = 1010, M = 21010;
int h[N], e[M], ne[M], w[M], idx;
bool st[N];
int dist[N];
int n, m, ed;
int dijkstra()
{
    memset(dist, 0x3f, sizeof dist);
    memset(st, false, sizeof st);
    dist[0] = 0;
    priority_queue<pii, vector<pii>, greater<pii> > q;
    q.emplace(0, 0);
    while (q.size())
    {
        auto t = q.top();
        q.pop();
        int ver = t.second;
        if (st[ver]) continue;
        st[ver] = true;
        for (int i = h[ver]; ~i; i = ne[i])
        {
            int j = e[i];
            if (dist[j] > dist[ver] + w[i])
            {
                dist[j] = dist[ver] + w[i];
                q.emplace(dist[j], j);
            }
        }
    }
    if (dist[ed] == 0x3f3f3f3f) dist[ed] = -1;
    return dist[ed];
}
void add(int a, int b, int c)
{
    e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx++;
}
int main()
{
    while (cin >> n >> m >> ed)
    {
        memset(h, -1, sizeof h);
        idx = 0;
        for (int i = 0; i < m; i++)
        {
            int a, b, c;
            cin >> a >> b >> c;
            add(a, b, c);
        }
        int s;
        cin >> s;
        while (s--)
        {
            int b;
            cin >> b;
            add(0, b, 0);
        }
        cout << dijkstra() << endl;
    }
    return 0;
}